package com.xcw.entity.req;

import com.google.common.base.Objects;
import lombok.Data;
import lombok.SneakyThrows;
import sun.reflect.generics.tree.Tree;
import sun.reflect.generics.tree.TypeTree;
import sun.reflect.generics.visitor.TypeTreeVisitor;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

/**
 * @Author bhx
 * @Date 2022/7/7 1:29
 * @Description TODO
 */
public class Test {
    @SneakyThrows
    public static void main(String[] args) {
        Employee employee1 = new Employee("1","zs","1000");
        Employee employee2 = new Employee("2","ls","500");
        Employee employee3 = new Employee("3","ww","300");
        Employee employee4= new Employee("4","wemz","1900");
        Map<String, Employee> map = new HashMap<>();
        map.put(employee1.getId(),employee1);
        map.put(employee2.getId(),employee2);
        map.put(employee3.getId(),employee3);
        map.put(employee4.getId(),employee4);
        System.out.println(Objects.equal(null, null));
        System.out.println(Objects.equal("1", "1"));
        System.out.println(Objects.equal("asdsd1", "asdasd2"));
        System.out.println(Objects.equal("asdf", "asdf"));

        Set<String> strings = map.keySet();
        for (String key: strings) {
            Employee employee = map.get(key);
            if (Integer.valueOf(employee.getSalary()) > 500){
                System.out.println(key);
                System.out.println(employee);
            }
        }
        System.out.println("----------------------------------------------");

        Set<Map.Entry<String, Employee>> entries = map.entrySet();
        for (Map.Entry entry:entries) {
            Employee employee = (Employee) entry.getValue();
            if (Integer.valueOf(employee.getSalary()) > 500){
                System.out.println(entry.getKey());
                System.out.println(employee);
            }

        }
        System.out.println("----------------------------------------------");
        Iterator<Map.Entry<String, Employee>> iterator = entries.iterator();
        while (iterator.hasNext()) {
            Map.Entry<String, Employee> next =  iterator.next();
            System.out.println(next.getKey());
            System.out.println(next.getValue());
        }

        String s = "sss";
        boolean aaa = s.matches("aaa");
        boolean aaa1 = s.matches("Sss");
        System.out.println(aaa);
        System.out.println(aaa1);
        StringBuffer sb = new StringBuffer();
        System.out.println(sb.length());
        System.out.println(sb.charAt(2));

    }

}
@Data
class Employee{
    private String id;
    private String name;
    private String salary;

    public Employee() {
    }

    public Employee(String id, String name, String salary) {
        this.id = id;
        this.name = name;
        this.salary = salary;
    }

    @Override
    public String toString() {
        return "Employee{" +
                "id='" + id + '\'' + '\n'+
                ", name='" + name + '\'' + '\n' +
                ", salary='" + salary + '\'' + '\n' +
                '}';
    }
}
